package com.cbb.lease.controller;

import com.cbb.lease.pojo.entity.Type;
import com.cbb.lease.pojo.vo.Catvo;
import com.cbb.lease.service.TypeService;
import com.gsj.common.pojo.R;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-eighth01
 * @description: 这是一个 conrtoller
 * @author: 陈斌斌
 * @create: 2021-07-24 14:15
 **/
@RestController
@RequestMapping("lease/type")
public class TypeController {
    @Resource
    private TypeService typeService;

    @GetMapping("getAllType")
    @ApiOperation(value = "getAllType",httpMethod = "get")
    public R  getAllType(){
        return typeService.getAllType();
    }


    @PostMapping ("getAllTypePage/{currentPage}/{pageSize}")
    @ApiOperation(value = "getAllTypePage",httpMethod = "post")
    public R  getAllTypePage(@PathVariable("currentPage")Integer currentPage,
                             @PathVariable("pageSize")Integer pageSize,
                             @RequestBody Type type){
        return typeService.getAllTypePage(currentPage,pageSize,type);
    }


    @ApiOperation(value = "delById",httpMethod = "delete")
    @DeleteMapping("delById")
    public R delById(@ApiParam(value = "类型主键ID")
                             Integer id){
        return typeService.delById(id);
    }

    @ApiOperation(value = "updateType",httpMethod = "put")
    @PutMapping("updateType")
    public R updateType(@ApiParam(value = "type实体类")
                        @RequestBody Type type){
        return typeService.updateType(type);
    }


    @ApiOperation(value = "addType",httpMethod = "post")
    @PostMapping ("addType")
    public R addType(@ApiParam(value = "type实体类")
                        @RequestBody Type type){
        return typeService.addType(type);
    }



}
